<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ include file="/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>网址采集策略</title>
</head>
  <body>
       <div class="content_bg">
 	 	<div class="rhead">
 	 		<div class="rpos">当前位置:  数据采集 - 网址采集策略</div>
 	 	</div>
 	 	
 	 	<s:form action="createWebsiteStrategy" theme="simple" onsubmit="return checkWebsiteStrategy()" method="post">
 	 		<s:hidden name="websiteStrategy.id"/>
 	 		<s:hidden name="collectionTask.id"/>
 	 		<s:hidden name="taskId"/>
	 	 	<div class="rhead">
	 	 		<div class="textRow"><div class="textLabel">是否自动分页(<span style="color:red">*</span>)：</div>
	 	 		<div class="textContent"><s:radio name="websiteStrategy.autoPage" list="#{'true':'是', 'false':'否'}" id="autoPage" value="'true'" cssClass="autoPage" onchange="changeURLModel()"/> 
	 	 		</div>
	 	 		</div>
	 	 		<div class="textRow"><div class="textLabel">采集URL(<span style="color:red">*</span>)：</div>
	 	 		<div class="textContent" id="urlModel">
	 	 		<s:textfield name="websiteStrategy.url" cssClass="textInfo" size="80" maxlength="100" id="url" onblur="createUrlParam()"/>
	 	 		<span id="urlMsg" style="color:red">(使用'{*}'匹配多个URL)</span>
	 	 		</div>
	 	 		</div>
	 	 		<div id="urlParam">
 	 				<s:iterator value="urlParams" var="param" status="stat">
	 	 			<s:hidden name="urlParams[%{#stat.index}].id" value="%{#param.id}" />
	 	 			<div class='textRow'><div class='textLabel'>URL参数<s:property value="#stat.count"/>(<span style='color:red'>*</span>)：<s:hidden name="urlParams[%{#stat.index}].paramIndex" value="%{#stat.index}" cssClass='textInfo step' /></div><div class='textContent'>开始：<s:textfield name="urlParams[%{#stat.index}].start" value="%{#param.start}" cssClass='textInfo step' size='5' maxlength='10'/>&nbsp;结束：<s:textfield name="urlParams[%{#stat.index}].end" value="%{#param.end}"  cssClass='textInfo step' size='5' maxlength='10'/>&nbsp;增减：<s:textfield name="urlParams[%{#stat.index}].step" value="%{#param.step}" cssClass='textInfo step' size='5' maxlength='10'/><span id='stepMsg'></span></div></div>
	 	 			</s:iterator>
 	 			</div>
	 	 		<div class="textRow"><div class="textLabel">页面编码(<span style="color:red">*</span>)：</div>
	 	 		<div class="textContent">
	 	 		<s:select name="websiteStrategy.charCode" cssClass="textInfo" list="#{'UTF-8':'UTF-8','GBK':'GBK','GB2312':'GB2312'}"  id="charCode"/>
	 	 		<span id="charCodeMsg" style="color:red"></div>
	 	 		</div>
	 	 		
	 	 		<div class="textRow" id="selfStrategy"><div class="textLabel">&nbsp;</div>
	 	 		<div class="textContent"><a href="javascript:addStrategy()">添加网址采集策略</a></div>
	 	 		</div>
	 	 		
	 	 	 	<div class="list" style="margin-left:130px;width:900px">
	 	 			<table id="strategyList" width="80%" cellpadding="0" cellspacing="0">
	 	 				<tr id="index_-1">
	 	 					<th>策略字段名称</th>
	 	 					<th>采集策略</th>
	 	 					<th>策略参数值</th>
	 	 					<th>分页开始标签</th>
	 	 					<th>分页结束标签</th>
	 	 					<th>采集页数</th>
	 	 					<th>下载文件</th>
	 	 					<th>保存路径</th>
	 	 					<th>过滤标签</th>
	 	 					<th>操作</th>
	 	 				</tr>
	 	 				
	 	 			<s:iterator value="baseStrategies" var="strategy" status="stat">
 	 				  <s:hidden name="baseStrategies[%{#stat.index}].id"/>
 	 				  	<tr id="index_<s:property value="#stat.index"/>">
	 	 					<td class="tdFieldName"><s:hidden name="baseStrategies[%{#stat.index}].fieldName"/><span><s:property value="#strategy.fieldName"/></span></td>
	 	 					<td class="tdStrategy"><s:hidden name="baseStrategies[%{#stat.index}].strategy"/><span><s:property value="#strategy.strategy"/></span></td>
	 	 					<td class="tdStrategyValue">
	 	 						<s:if test="#strategy.strategy.toString() == @com.collection.entity.BaseStrategy$Strategy@TAG.toString()">
	 	 							<s:hidden name="baseStrategies[%{#stat.index}].strategyValue.startTag"/><s:hidden name="baseStrategies[%{#stat.index}].strategyValue.endTag"/>
	 	 							<span><s:property value="#strategy.strategyValue.startTag"/>,<s:property value="#strategy.strategyValue.endTag"/></span>
	 	 						</s:if>
	 	 						<s:elseif test="#strategy.strategy.toString() == @com.collection.entity.BaseStrategy$Strategy@REGULAR.toString()">
	 	 							<s:hidden name="baseStrategies[%{#stat.index}].strategyValue.regular"/>
	 	 							<span>
	 	 							<s:property value="#strategy.strategyValue.regular"/>
	 	 							</span>
	 	 						</s:elseif>
	 	 						<s:elseif test="#strategy.strategy.toString() == @com.collection.entity.BaseStrategy$Strategy@XPATH.toString()">
	 	 							<s:hidden name="baseStrategies[%{#stat.index}].strategyValue.xpath"/><s:hidden name="baseStrategies[%{#stat.index}].strategyValue.xpathMode"/>
	 	 							<span><s:property value="#strategy.strategyValue.xpath"/> <s:if test="#strategy.strategyValue.xpathMode != null">,<s:property value="#strategy.strategyValue.xpathMode"/></s:if>
	 	 							</span>
	 	 						</s:elseif>
	 	 					</td>
	 	 					<td class="tdPageStartTag"><s:hidden name="baseStrategies[%{#stat.index}].pageStartTag"/><span><s:property value="#strategy.pageStartTag"/></span></td>
	 	 					<td class="tdPageEndTag"><s:hidden name="baseStrategies[%{#stat.index}].pageEndTag"/><span><s:property value="#strategy.pageEndTag"/></span></td>
	 	 					<td class="tdPageNums"><s:hidden name="baseStrategies[%{#stat.index}].pageNums"/><span><s:property value="#strategy.pageNums"/></span></td>
	 	 					<td class="tdDownload"><s:hidden name="baseStrategies[%{#stat.index}].download"/><span><s:property value="#strategy.download"/></span></td>
	 	 					<td class="tdDownloadDir"><s:hidden name="baseStrategies[%{#stat.index}].downloadDir"/><span><s:property value="#strategy.downloadDir"/></span></td>
	 	 					<td class="tdFilterTag">
	 	 					  <s:if test="#strategy.filterTag != null">
		 	 					   <s:iterator value="#strategy.filterTag" var="filterTag" status="statFilter">
		 	 					       <s:hidden name="baseStrategies[%{#stat.index}].filterTag[%{#statFilter.index}].id" />
		 	 						   <s:hidden name="baseStrategies[%{#stat.index}].filterTag[%{#statFilter.index}].tagName" />
		 	 						</s:iterator>
		 	 						<span>
		 	 						<s:iterator value="#strategy.filterTag" var="filterTag" status="statFilter">
		 	 						   <s:if test="!#statFilter.last">
		 	 						   		<s:property value="#filterTag.tagName"/>,
		 	 						   </s:if>
		 	 						   <s:else>
		 	 						   		<s:property value="#filterTag.tagName"/>
		 	 						   </s:else>
		 	 						</s:iterator>
		 	 						</span>
	 	 						</s:if>
	 	 					</td>
	 	 					<td><a href='javascript:updateStrategy("index_<s:property value="#stat.index"/>")'>修改</a>|<a href='javascript:deleteStrategy("index_<s:property value="#stat.index"/>")' onclick='return confirm("您真的要做删除操作？")'>删除</a></td>
 	 				    </tr>
 	 				</s:iterator>
	 	 			</table>
	 	 		</div>
	 	 	</div>
	 	 	
	 	 	<div class="rhead">
	 	 		<span style="margin-left:140px"><s:submit value="下一步"></s:submit></span>
	 	 	</div>
 	 	</s:form>
 	   </div>
 	
 	<s:include value="strategy_edit.jsp"></s:include>   
  </body>
</html>



